import json

import requests

#序列化模块
import hashlib

#时间模块
import time

em_token = "145a579aafd94a633ae573769d936f2b"

eE = int(time.time() * 1000)
#u = 1742279459628

eC = '12574478'

params = {
    "resId":34667024,
    "bizId":"443"
}

ep_data_1 = {
    "params": json.dumps(params)
}

ep_data = json.dumps(ep_data_1).replace(' ', '')

ep_data1 = '{"params":"{\\"bizId\\":\\"443\\",\\"resId\\":\\"36500751\\",\\"bizCode\\":\\"search\\"}"}'
print(ep_data1)
print(ep_data)

#n_data = '{"params":"{\\"bizId\\":\\"443\\",\\"resId\\":\\"36500751\\",\\"bizCode\\":\\"search\\"}"}'

string = em_token + "&" + str(eE) + "&" + eC + "&" + ep_data1

MD5 = hashlib.md5()

MD5.update(string.encode('utf-8'))

sign = MD5.hexdigest()

print(sign)

headers = {
    #cookie 用户信息
    'cookie':'thw=cn; wk_cookie2=1c38b048ecc2bf17f3a600b94dec35a1; t=a08b8fa0e65fbc557cb369f6b6719455; xlly_s=1; wk_unb=UUpgT7oqPKaJPbfxNA%3D%3D; env_bak=FM%2Bgnk3pmwpGhEMmE2NYZzLpw%2BY5KfNc3G6S7XCadENP; cookie2=1e4d5d53ef8a6a8456b88368fa175c3c; _tb_token_=ee37935ae5eeb; mtop_partitioned_detect=1; _m_h5_tk=9af931020a046be97b1992c4dcf13a3c_1742287433664; _m_h5_tk_enc=7ad27d426f18869dfbb3d0ba2de37a4d; _samesite_flag_=true; sdkSilent=1742365194979; havana_sdkSilent=1742365194979; x5sec=7b2274223a313734323238313137342c22733b32223a2231343132613231376535643331633731222c22617365727665723b33223a22307c434c657a354c3447454e50373366582b2f2f2f2f2f774561447a49794d546b314d5459344d5441304e4441374d5444792f2f437342513d3d227d; mt=ci=0_0; cna=zk7oGdZyDAkCAd9fP8XjvdLt; 3PcFlag=1742281363724; sgcookie=E100NFq5FLy4vgpXO2HfT2EOLUJKYGVNHhHxZtd7fOZgel%2B1RXip7offjkvWKqqpjnwwWkgICyEI4A69UxADKEoB8L0LFMLJ%2F40ThgvdroDVxng%3D; havana_lgc2_0=eyJoaWQiOjIyMTk1MTY4MTA0NDAsInNnIjoiNjdjZGVjMGJlOGMyNzQwZTQ4NDdkODdhODZmZTBiNWUiLCJzaXRlIjowLCJ0b2tlbiI6IjFKRHBzZEpybTJvYWJPa00zakdOZy13In0; _hvn_lgc_=0; havana_lgc_exp=1773385391925; cookie3_bak=1e4d5d53ef8a6a8456b88368fa175c3c; cookie3_bak_exp=1742540591925; unb=2219516810440; uc1=cookie16=VT5L2FSpNgq6fDudInPRgavC%2BQ%3D%3D&cookie15=U%2BGCWk%2F75gdr5Q%3D%3D&pas=0&cookie14=UoYaibL8bDzufw%3D%3D&cookie21=V32FPkk%2FhSg%2F&existShop=false; sn=; uc3=nk2=F5RMHljvT2ll6bdPyn4%3D&vt3=F8dD2EjAURWcDiULOv0%3D&lg2=Vq8l%2BKCLz3%2F65A%3D%3D&id2=UUpgT7oqPKaJPbfxNA%3D%3D; csg=ae12098d; lgc=tb972620971155; cancelledSubSites=empty; cookie17=UUpgT7oqPKaJPbfxNA%3D%3D; dnk=tb972620971155; skt=dd2731b9762c2547; existShop=MTc0MjI4MTM5MQ%3D%3D; uc4=nk4=0%40FY4HWy3ISElNjSrfRbkOkgh5cQledLt8iQ%3D%3D&id4=0%40U2gqwAWmb6j7BvGjGSyUWCnC%2FP14MjlT; tracknick=tb972620971155; _cc_=V32FPkk%2Fhw%3D%3D; _l_g_=Ug%3D%3D; sg=501; _nk_=tb972620971155; cookie1=VANAQNXLKMR5RONDn%2FmWigF2PVB2rTA5%2BM%2FwuD%2FcRl8%3D; tfstk=glFnweijlJkCMljtB5GCHMoupd69dXGSdud-2bnPQco69YoRduDu2lMz9XULj0rYq4FLw726Zra79wGRRXaINbSADshuRyG7UaDh7GUNz4Go86fOBwzINbS9WQWAiyZ2KUY484uNS43JTHrrLckZf4pEaDkybduqbblrYBkw_q0jzBkeaN4Zf4lr4ukFSfoszXlvBDHxI5SNrqkMu4u7s2Dn0PXXaQVwMvm48cAP250hfmzEjQRovZC46P4dxIatO5EmkkCwto4U3uy4b1AnCJzgZxNWYNlrURexKRjeZcFKrxlrIURzSXosh7lVgh0_QyezOkYka2NLMYmjIaRSefPx3-rHPZaZT4rSh7IXODzzlSwxi_AZtYSrndJ4GoAS7aFwFLME5VmY1KAFRt8nbUbGSKlnLVgezNbMFLME5VmASNv4Evus8U5..; isg=BPr6FszNSaw6JcdIQYaDfUfBSyAcq36FArUVcQTzpA1Y95ox7DpnlRAJR4Mr4fYd',
    #user-agent 用户代理
    'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0'

}

#请求网址
url = 'https://h5api.m.taobao.com/h5/mtop.relationrecommend.wirelessrecommend.recommend/2.0/'

data = {
    'jsv': '2.7.4',
    'appKey': '12574478',
    't': eE,
    'sign': sign,
    'api': 'mtop.relationrecommend.wirelessrecommend.recommend',
    'v': '2.0',
    'timeout': '10000',
    'type': 'jsonp',
    'dataType': 'jsonp',
    'callback': 'mtopjsonp5',
    'data': '{"appId":"34385","params":"{\"device\":\"HMA-AL00\",\"isBeta\":\"false\",\"grayHair\":\"false\",\"from\":\"nt_history\",\"brand\":\"HUAWEI\",\"info\":\"wifi\",\"index\":\"4\",\"rainbow\":\"\",\"schemaType\":\"auction\",\"elderHome\":\"false\",\"isEnterSrpSearch\":\"true\",\"newSearch\":\"false\",\"network\":\"wifi\",\"subtype\":\"\",\"hasPreposeFilter\":\"false\",\"prepositionVersion\":\"v2\",\"client_os\":\"Android\",\"gpsEnabled\":\"false\",\"searchDoorFrom\":\"srp\",\"debug_rerankNewOpenCard\":\"false\",\"homePageVersion\":\"v7\",\"searchElderHomeOpen\":\"false\",\"search_action\":\"initiative\",\"sugg\":\"_4_1\",\"sversion\":\"13.6\",\"style\":\"list\",\"ttid\":\"600000@taobao_pc_10.7.0\",\"needTabs\":\"true\",\"areaCode\":\"CN\",\"vm\":\"nw\",\"countryNum\":\"156\",\"m\":\"pc\",\"page\":1,\"n\":48,\"q\":\"%E9%94%AE%E7%9B%98\",\"qSource\":\"url\",\"pageSource\":\"a21bo.jianhua/a.201856.d13\",\"tab\":\"all\",\"pageSize\":48,\"totalPage\":100,\"totalResults\":4800,\"sourceS\":\"0\",\"sort\":\"_coefp\",\"bcoffset\":\"\",\"ntoffset\":\"\",\"filterTag\":\"\",\"service\":\"\",\"prop\":\"\",\"loc\":\"\",\"start_price\":null,\"end_price\":null,\"startPrice\":null,\"endPrice\":null,\"itemIds\":null,\"p4pIds\":null,\"p4pS\":null,\"categoryp\":\"\",\"ha3Kvpairs\":null,\"myCNA\":\"zk7oGdZyDAkCAd9fP8XjvdLt\",\"screenResolution\":\"1494x934\",\"userAgent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0\",\"couponUnikey\":\"\"}"}'
}

#发送请求
response = requests.get(url=url, params=data, headers=headers)

text = response.text

print(text)